'''
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with self work for additional information
 * regarding copyright ownership.  The ASF licenses self file
 * to you under the Apache License, Version 2.0 (the
 * "License") you may not use self file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
'''
# from base.graph.NodeFactory import NodeFactory
from base.rdf.Impl import Impl
# from base.rdf.impl.LiteralImpl import LiteralImpl
# from base.rdf.impl.PropertyImpl import PropertyImpl
# from base.rdf.impl.ResourceImpl import ResourceImpl
# from base.rdf.impl.StatementImpl import StatementImpl

#import java.util.Calendar;

#import org.apache.jena.datatypes.RDFDatatype;
#import org.apache.jena.datatypes.xsd.XSDDatatype;
#import org.apache.jena.datatypes.xsd.XSDDateTime;
#import org.apache.jena.graph.NodeFactory;
#import org.apache.jena.graph.impl.LiteralLabel;
#import org.apache.jena.graph.impl.LiteralLabelFactory;
#import org.apache.jena.rdf.model.impl.*;

'''
 * A Factory class for creating resources.
 *
 * <p> This class creates resources and properties and things of that ilk.
 * These resources are <i>not</i> associated with a user-modifiable
 * model: doing getModel() on them will return None.
 * </p>
 *
 * <p> It is designed as a singleton.  There are static convenience
 * methods on self class itself, so the easy way to create resource
 * is for example to do something like:</p>
 * <pre>
 *   <code>Resource r = ResourceFactory.createResource()</code>
 * </pre>
 *
 * <p> If a factory object is needed, then self can be obtained using
 * the <code>getInstance</code> method on the class.  The factory
 * object used may be changed using the <code>setInstance</code>
 * method.</p>
'''
class ResourceFactory:

    instance = Impl()

    '''
     * Get the current factory object.
     *
     * @return the current factory object
    '''
    # param 
    # result static Interface
    @staticmethod
    def getInstance():
        return ResourceFactory.instance
    

    '''
     * Set the current factory object.
     *
     * @param newInstance the factory object
     * @return the previous factory object
    '''
    # param Interface newInstance
    # result static Interface
    @staticmethod
    def setInstance(newInstance):
        previousInstance = ResourceFactory.instance
        ResourceFactory.instance = newInstance
        return previousInstance
    

    '''
     * Create a anonymous resource.
     *
     * <p>Uses the current factory object to create a anonymous resource.</p>
     *
     * @return a anonymous resource
    '''
    # param 
    # result static Resource
    @staticmethod
    def createResource():
        return ResourceFactory.instance.createResource()
    

    '''
     * Create a resource.
     *
     * <p>Uses the current factory object to create a resource.</p>
     *
     * @param uriref URIREF of the resource
     * @return a resource
    '''
    # param String uriref
    # result static Resource
    @staticmethod
    def createResourceWithUri(uriref):
        return ResourceFactory.instance.createResourceWithUri(uriref)
    

    '''
     * Create a resource representing an RDF-star triple term.
     *
     * @param statement
     * @return a resource
    '''
    # param Statement statement
    # result static Resource
    @staticmethod
    def createStmtResource(statement):
        return ResourceFactory.instance.createStmtResource(statement)
    

    '''
     * Answer a string (xsd:string) literal.
     * This is the equivalent of a plain literal with no language from RDF 1.0
     * (also called a simple literal in SPARQL)
     * <p>
     * Using:@link #createStringLiteralis preferred "plain literal" is RDF 1.0 terminology.
     *
     * @param string the string which forms the value of the literal
     * @return a Literal node with that string as value
    '''
    # param String string
    # result static Literal
    @staticmethod
    def createPlainLiteral(string):
        return ResourceFactory.instance.createStringLiteral(string)
    

    '''
     * Answer a string (xsd:string) literal.
     * This is the equivalent of a plain literal with no language from RDF 1.0
     * (also called a simple literal in SPARQL)
     *
     * @param string the string which forms the value of the literal
     * @return a Literal node with that string as value
    '''
    # param String string
    # result static Literal
    @staticmethod
    def createStringLiteral(string):
        return ResourceFactory.instance.createStringLiteral(string)
    

    '''
     * Answer a literal with language and the given content. The literal will
     * have datatype rdf:langString.
     *
     * @param string the string which forms the value of the literal
     * @param lang   The language tag to be used
     * @return a Literal node with that string as value
    '''
    # param String string, String lang
    # result static Literal
    @staticmethod
    def createLangLiteral(string, lang):
        return ResourceFactory.instance.createLangLiteral(string, lang)
    

    '''
     * Answer a typed literal.
     *
     * @param string the string which forms the value of the literal
     * @param dType  RDFDatatype of the type literal
     * @return a Literal node with that string as value
    '''
    # param String string, RDFDatatype dType
    # result static Literal
    @staticmethod
    def createTypedLiteral(string, dType):
        return ResourceFactory.instance.createTypedLiteral(string, dType)
    

    '''
     * Answer a typed literal.
     *
     * @param value a java Object, the default RDFDatatype for that object will be used
     * @return a Literal node with that value
    '''
    # param Object value
    # result static Literal
    @staticmethod
    def createTypedLiteralWithValue(value):
        return ResourceFactory.instance.createTypedLiteral(value)
    

    '''
     * Create a property.
     *
     * <p>Uses the current factory object to create a resource.</p>
     *
     * @param uriref URIREF of the property
     * @return a property
    '''
    # param String uriref
    # result static Property
    @staticmethod
    def createProperty(uriref):
        return ResourceFactory.instance.createProperty(uriref)
    

    '''
     * Create a property.
     *
     * <p>Uses the current factory object to create a property.</p>
     *
     * @param namespace URIREF of the namespace of the property
     * @param localName localname of the property
     * @return a property
    '''
    # param String namespace, String localName
    # result static Property
    @staticmethod
    def createPropertyWithNameSpaceAndLocalName(namespace, localName):
        return ResourceFactory.instance.createPropertyWithNamespaceAndLocalName(namespace, localName)
    

    '''
     * Create a statement.
     * <p>
     * Uses the current factory object to create a statement.</p>
     *
     * @param subject   the subject of the statement
     * @param predicate the predicate of the statement
     * @param object    the object of the statement
     * @return a resource
    '''
    # param Resource subject, Property predicate, RDFNode obj
    @staticmethod
    def createStatement(subject, predicate, obj):
        return ResourceFactory.instance.createStatement(subject, predicate, obj)
    


        
    

